﻿using CinemaMaestro.DataLayer.Contracts.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace CinemaMaestro.WebApplication.Models
{
    public class ScreeningViewModels
    {
        public int Id { get; set; }
        public DateTime StartDate { get; set; }
        public DateTime EndDate { get; set; }
        public Double Price { get; set; }
        public Double DiscountedPrice { get; set; }

        public virtual MovieViewModels Movie { get; set; }
        public virtual RoomViewModels Room { get; set; }
        public virtual LanguageViewModels Language { get; set; }

        public static implicit operator ScreeningViewModels(Screening screening)
        {
            return new ScreeningViewModels
            {
                Id = screening.Id,
                StartDate = screening.StartDate,
                EndDate = screening.EndDate,
                Price = screening.Price,
                DiscountedPrice = screening.DiscountedPrice,
                Movie = screening.Movie,
                Room = screening.Room,
                Language = screening.Language
            };
        }

        public static implicit operator Screening(ScreeningViewModels screeningVM)
        {
            return new Screening
            {
                Id = screeningVM.Id,
                StartDate = screeningVM.StartDate,
                EndDate = screeningVM.EndDate,
                Price = screeningVM.Price,
                DiscountedPrice = screeningVM.DiscountedPrice,
                Movie = screeningVM.Movie,
                Room = screeningVM.Room,
                Language = screeningVM.Language
            };
        }
    }
}